<?xml version="1.0" encoding="iso-8859-1"?>
<xsd:schema xmlns="http://www.eeml.org/xsd/0.5.1" elementFormDefault="qualified" targetNamespace="http://www.eeml.org/xsd/0.5.1" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <xsd:element name="eeml">
    <xsd:complexType>
      <xsd:choice>
        <xsd:element maxOccurs="unbounded" name="environment">
          <xsd:complexType>         
            <xsd:sequence>
              <xsd:element minOccurs="0" name="title" type="xsd:string" />
              <xsd:element minOccurs="0" name="feed" type="xsd:anyURI" />
              <xsd:element minOccurs="0" name="status">
                <xsd:simpleType>
                  <xsd:restriction base="xsd:string">
                    <xsd:enumeration value="frozen" />
                    <xsd:enumeration value="live" />
                  </xsd:restriction>
                </xsd:simpleType>
              </xsd:element>
              <xsd:element minOccurs="0" name="private">
                <xsd:simpleType>
                  <xsd:restriction base="xsd:string">
                    <xsd:enumeration value="true" />
                    <xsd:enumeration value="false" />
                  </xsd:restriction>
                </xsd:simpleType>
              </xsd:element>
              <xsd:element minOccurs="0" name="description" type="xsd:string" />
              <xsd:element minOccurs="0" name="icon" type="xsd:anyURI" />
              <xsd:element minOccurs="0" name="website" type="xsd:anyURI" />
              <xsd:element minOccurs="0" name="email" type="xsd:string" />
              <xsd:element minOccurs="0" maxOccurs="unbounded" name="tag" type="xsd:string" />
              <xsd:element minOccurs="0" name="location">
                <xsd:complexType>
                  <xsd:sequence>
                    <xsd:element minOccurs="0" name="name" type="xsd:string" />
                    <xsd:element name="lat">
                      <xsd:simpleType>
                        <xsd:restriction base="xsd:double">
                          <xsd:minInclusive value="-90" />
                          <xsd:maxInclusive value="90" />
                        </xsd:restriction>
                      </xsd:simpleType>
                    </xsd:element>
                    <xsd:element name="lon">
                      <xsd:simpleType>
                        <xsd:restriction base="xsd:double">
                          <xsd:minInclusive value="-180" />
                          <xsd:maxInclusive value="180" />
                        </xsd:restriction>
                      </xsd:simpleType>
                    </xsd:element>
                    <xsd:element minOccurs="0" maxOccurs="1" name="ele" type="xsd:double" />
                  </xsd:sequence>
                  <xsd:attribute name="exposure" use="optional">
                    <xsd:simpleType>
                      <xsd:restriction base="xsd:string">
                        <xsd:enumeration value="indoor" />
                        <xsd:enumeration value="outdoor" />
                      </xsd:restriction>
                    </xsd:simpleType>
                  </xsd:attribute>
                  <xsd:attribute name="domain" use="required">
                    <xsd:simpleType>
                      <xsd:restriction base="xsd:string">
                        <xsd:enumeration value="physical" />
                        <xsd:enumeration value="virtual" />
                      </xsd:restriction>
                    </xsd:simpleType>
                  </xsd:attribute>
                  <xsd:attribute name="disposition" use="optional">
                    <xsd:simpleType>
                      <xsd:restriction base="xsd:string">
                        <xsd:enumeration value="fixed" />
                        <xsd:enumeration value="mobile" />
                      </xsd:restriction>
                    </xsd:simpleType>
                  </xsd:attribute>
                </xsd:complexType>
              </xsd:element>            
              <xsd:element minOccurs="1" maxOccurs="unbounded" name="data">
                <xsd:complexType>
                  <xsd:sequence>
                    <xsd:element minOccurs="0" maxOccurs="unbounded" name="tag" type="xsd:string" />
                    <xsd:element name="current_value">
                      <xsd:complexType>
                        <xsd:simpleContent>
                          <xsd:extension base="xsd:string">
                            <xsd:attribute name="at" type="xsd:dateTime" use="optional" />
                          </xsd:extension>
                        </xsd:simpleContent>
                      </xsd:complexType>
                    </xsd:element>
                    <xsd:element minOccurs="0" maxOccurs="1" name="max_value" type="xsd:string" />
                    <xsd:element minOccurs="0" maxOccurs="1" name="min_value" type="xsd:string" />
                    <xsd:element minOccurs="0" maxOccurs="1" name="datapoints">
                      <xsd:complexType>
                        <xsd:sequence>
                          <xsd:element minOccurs="0" maxOccurs="unbounded" name="value">
                            <xsd:complexType>
                              <xsd:simpleContent>
                                <xsd:extension base="xsd:string">
                                  <xsd:attribute name="at" type="xsd:dateTime" use="optional" />
                                </xsd:extension>
                              </xsd:simpleContent>
                            </xsd:complexType>
                          </xsd:element>
                        </xsd:sequence>
                      </xsd:complexType>
                    </xsd:element>
                    <xsd:element minOccurs="0" maxOccurs="1" name="unit">
                      <xsd:complexType>
                        <xsd:simpleContent>
                          <xsd:extension base="xsd:string">
                            <xsd:attribute name="symbol" type="xsd:string" use="optional">
                            </xsd:attribute>
                            <xsd:attribute name="type" use="optional">
                              <xsd:simpleType>
                                <xsd:restriction base="xsd:string">
                                  <xsd:enumeration value="basicSI" />
                                  <xsd:enumeration value="derivedSI" />
                                  <xsd:enumeration value="conversionBasedUnits" />
                                  <xsd:enumeration value="derivedUnits" />
                                  <xsd:enumeration value="contextDependentUnits" />
                                </xsd:restriction>
                              </xsd:simpleType>
                            </xsd:attribute>
                          </xsd:extension>
                        </xsd:simpleContent>
                      </xsd:complexType>
                    </xsd:element>
                  </xsd:sequence>
                  <xsd:attribute name="id" type="xsd:nonNegativeInteger" use="required" />
                </xsd:complexType>
              </xsd:element>
             </xsd:sequence>            
            <xsd:attribute name="updated" use="optional">
              <xsd:simpleType>
                <xsd:restriction base="xsd:dateTime" />
              </xsd:simpleType>
            </xsd:attribute>
            <xsd:attribute name="creator" use="optional">
              <xsd:simpleType>
                <xsd:restriction base="xsd:string" />
              </xsd:simpleType>
            </xsd:attribute>
            <xsd:attribute name="id" type="xsd:nonNegativeInteger" use="optional" />
          </xsd:complexType>
        </xsd:element>
      </xsd:choice>
      <xsd:attribute name="version" use="optional">
        <xsd:simpleType>
          <xsd:restriction base="xsd:string">            
            <xsd:enumeration value="0.5.1" />
          </xsd:restriction>
        </xsd:simpleType>
      </xsd:attribute>
    </xsd:complexType>
  </xsd:element>
</xsd:schema>
